skip to main content
10.1145/3519939.3523447acmconferencesArticle/Chapter ViewAbstractPublication PagespldiConference Proceedingsconference-collections

Progressive polynomial approximations for fast correctly rounded math libraries

Published:09 June 2022Publication History

ABSTRACT

This paper presents a novel method for generating a single polynomial approximation that produces correctly rounded results for all inputs of an elementary function for multiple representations. The generated polynomial approximation has the nice property that the first few lower degree terms produce correctly rounded results for specific representations of smaller bitwidths, which we call progressive performance. To generate such progressive polynomial approximations, we approximate the correctly rounded result and formulate the computation of correctly rounded polynomial approximations as a linear program similar to our prior work on the RLIBM project. To enable the use of resulting polynomial approximations in mainstream libraries, we want to avoid piecewise polynomials with large lookup tables. We observe that the problem of computing polynomial approximations for elementary functions is a linear programming problem in low dimensions, i.e., with a small number of unknowns. We design a fast randomized algorithm for computing polynomial approximations with progressive performance. Our method produces correct and fast polynomials that require a small amount of storage. A few polynomial approximations from our prototype have already been incorporated into LLVM’s math library.

References

  1. Mridul Aanjaneya, Jay P. Lim, and Santosh Nagarakatte. 2022. RLibm-Prog. https://github.com/rutgers-apl/rlibm-progGoogle ScholarGoogle Scholar
  2. Sylvie Boldo, Marc Daumas, and Ren-Cang Li. 2009. Formally Verified Argument Reduction with a Fused Multiply-Add. In IEEE Transactions on Computers. 58, 1139–1145. https://doi.org/10.1109/TC.2008.216 Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Peter Borwein and Tamas Erdelyi. 1995. Polynomials and Polynomial Inequalities. Springer New York. isbn:9780387945095 lccn:95008374 https://doi.org/10.1007/978-1-4612-0793-1 Google ScholarGoogle ScholarCross RefCross Ref
  4. Nicolas Brunie, Florent de Dinechin, Olga Kupriianova, and Christoph Lauter. 2015. Code Generators for Mathematical Functions. In 2015 IEEE 22nd Symposium on Computer Arithmetic. 66–73. https://doi.org/10.1109/ARITH.2015.22 Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Hung Tien Bui and Sofiene Tahar. 1999. Design and synthesis of an IEEE-754 exponential function. In Engineering Solutions for the Next Millennium. 1999 IEEE Canadian Conference on Electrical and Computer Engineering. 1, 450–455 vol.1. https://doi.org/10.1109/CCECE.1999.807240 Google ScholarGoogle ScholarCross RefCross Ref
  6. Sylvain Chevillard, John Harrison, Mioara Joldes, and Christoph Lauter. 2011. Efficient and accurate computation of upper bounds of approximation errors. In Theoretical Computer Science. 412, https://doi.org/10.1016/j.tcs.2010.11.052 Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Sylvain Chevillard, Mioara Joldes, and Christoph Lauter. 2010. Sollya: An Environment for the Development of Numerical Codes. In Mathematical Software - ICMS 2010 (Lecture Notes in Computer Science, Vol. 6327). Springer, Heidelberg, Germany. 28–31. https://doi.org/10.1007/978-3-642-15582-6_5 Google ScholarGoogle ScholarCross RefCross Ref
  8. Sylvain Chevillard and Christopher Lauter. 2007. A Certified Infinite Norm for the Implementation of Elementary Functions. In Seventh International Conference on Quality Software (QSIC 2007). 153–160. https://doi.org/10.1109/QSIC.2007.4385491 Google ScholarGoogle ScholarCross RefCross Ref
  9. Kenneth L. Clarkson. 1995. Las Vegas Algorithms for Linear and Integer Programming When the Dimension is Small. J. ACM, 42, 2 (1995), March, 488–499. issn:0004-5411 https://doi.org/10.1145/201019.201036 Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. William J Cody and William M Waite. 1980. Software manual for the elementary functions. Prentice-Hall, Englewood Cliffs, NJ. https://doi.org/10.1137/1024023 Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Catherine Daramy, David Defour, Florent Dinechin, and Jean-Michel Muller. 2003. CR-LIBM: A correctly rounded elementary function library. In Proceedings of SPIE Vol. 5205: Advanced Signal Processing Algorithms, Architectures, and Implementations XIII. 5205, https://doi.org/10.1117/12.505591 Google ScholarGoogle ScholarCross RefCross Ref
  12. Catherine Daramy-Loirat, David Defour, Florent de Dinechin, Matthieu Gallet, Nicolas Gast, Christoph Lauter, and Jean-Michel Muller. 2006. CR-LIBM A library of correctly rounded elementary functions in double-precision. Laboratoire de l’Informatique du Parallélisme. https://hal-ens-lyon.archives-ouvertes.fr/ensl-01529804Google ScholarGoogle Scholar
  13. Pavlos S. Efraimidis and Paul G. Spirakis. 2006. Weighted random sampling with a reservoir. Inform. Process. Lett., 97, 5 (2006), 181–185. issn:0020-0190 https://doi.org/10.1016/j.ipl.2005.11.003 Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Laurent Fousse, Guillaume Hanrot, Vincent Lefèvre, Patrick Pélissier, and Paul Zimmermann. 2007. MPFR: A Multiple-precision Binary Floating-point Library with Correct Rounding. ACM Trans. Math. Software, 33, 2 (2007), Article 13, June, issn:0098-3500 https://doi.org/10.1145/1236463.1236468 Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Ambros M. Gleixner, Daniel E. Steffy, and Kati Wolter. 2012. Improving the Accuracy of Linear Programming Solvers with Iterative Refinement. In Proceedings of the 37th International Symposium on Symbolic and Algebraic Computation (ISSAC ’12). Association for Computing Machinery, New York, NY, USA. 187–194. isbn:9781450312691 https://doi.org/10.1145/2442829.2442858 Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. David Goldberg. 1991. What Every Computer Scientist Should Know About Floating-point Arithmetic. In ACM Computing Surveys. 23, ACM, New York, NY, USA. 5–48. issn:0360-0300 https://doi.org/10.1145/103162.103163 Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. John Harrison. 1997. Floating point verification in HOL light: The exponential function. In Algebraic Methodology and Software Technology, Michael Johnson (Ed.). Springer Berlin Heidelberg, Berlin, Heidelberg. 246–260. https://doi.org/10.1007/BFb0000475 Google ScholarGoogle ScholarCross RefCross Ref
  18. John Harrison. 1997. Verifying the Accuracy of Polynomial Approximations in HOL. In International Conference on Theorem Proving in Higher Order Logics. https://doi.org/10.1007/BFb0028391 Google ScholarGoogle ScholarCross RefCross Ref
  19. John Harrison. 2009. HOL Light: An Overview. In Proceedings of the 22nd International Conference on Theorem Proving in Higher Order Logics, TPHOLs 2009, Stefan Berghofer, Tobias Nipkow, Christian Urban, and Makarius Wenzel (Eds.) (Lecture Notes in Computer Science, Vol. 5674). Springer-Verlag, Munich, Germany. 60–66. https://doi.org/10.1007/978-3-642-03359-9_4 Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Claude-Pierre Jeannerod, Hervé Knochel, Christophe Monat, and Guillaume Revy. 2011. Computing Floating-Point Square Roots via Bivariate Polynomial Evaluation. IEEE Trans. Comput., 60, https://doi.org/10.1109/TC.2010.152 Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Olga Kupriianova and Christoph Lauter. 2014. Metalibm: A Mathematical Functions Code Generator. In 4th International Congress on Mathematical Software. https://doi.org/10.1007/978-3-662-44199-2_106 Google ScholarGoogle ScholarCross RefCross Ref
  22. Vincent Lefèvre, Jean-Michel Muller, and Arnaud Tisserand. 1998. Toward correctly rounded transcendentals. IEEE Trans. Comput., 47, 11 (1998), 1235–1243. https://doi.org/10.1109/12.736435 Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Jay Lim. 2021. Novel Polynomial Approximation Methods for Generating Correctly Rounded Elementary Functions. Ph.D. Dissertation. Rutgers University.Google ScholarGoogle Scholar
  24. Jay P. Lim, Mridul Aanjaneya, John Gustafson, and Santosh Nagarakatte. 2020. A Novel Approach to Generate Correctly Rounded Math Libraries for New Floating Point Representations. arxiv:2007.05344. Rutgers Department of Computer Science Technical Report DCS-TR-753.Google ScholarGoogle Scholar
  25. Jay P. Lim, Mridul Aanjaneya, John Gustafson, and Santosh Nagarakatte. 2021. An Approach to Generate Correctly Rounded Math Libraries for New Floating Point Variants. Proceedings of the ACM on Programming Languages, 6, POPL (2021), Article 29, Jan., 30 pages. https://doi.org/10.1145/3434310 Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Jay P. Lim and Santosh Nagarakatte. 2021. High Performance Correctly Rounded Math Libraries for 32-bit Floating Point Representations. In 42nd ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI’21). https://doi.org/10.1145/3453483.3454049 Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Jay P Lim and Santosh Nagarakatte. 2021. RLIBM-32: High Performance Correctly Rounded Math Libraries for 32-bit Floating Point Representations. arxiv:2104.04043. Rutgers Department of Computer Science Technical Report DCS-TR-754.Google ScholarGoogle Scholar
  28. Jay P. Lim and Santosh Nagarakatte. 2021. RLIBM-ALL: A Novel Polynomial Approximation Method to Produce Correctly Rounded Results for Multiple Representations and Rounding Modes. arxiv:2108.06756. Rutgers Department of Computer Science Technical Report DCS-TR-757.Google ScholarGoogle Scholar
  29. Jay P. Lim and Santosh Nagarakatte. 2022. One Polynomial Approximation to Produce Correctly Rounded Results of an Elementary Function for Multiple Representations and Rounding Modes. Proceedings of the ACM on Programming Languages, 6, POPL (2022), Article 3, Jan., 28 pages. https://doi.org/10.1145/3498664 Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. Tue Ly. 2021. Implement correctly rounded logf based on RLIBM library. https://github.com/llvm/llvm-project/commit/d08a801b5f5678af52c89d202e5f22e0d43a38cdGoogle ScholarGoogle Scholar
  31. Tue Ly. 2022. Implement correctly rounded log10f based on RLIBM library. https://github.com/llvm/llvm-project/commit/e581841e8cf46109acea92e1acb661c404fa62b9Google ScholarGoogle Scholar
  32. Tue Ly. 2022. Implement correctly rounded log2f based on RLIBM library. https://github.com/llvm/llvm-project/commit/63d2df003e9c198bfa70d448f8ad7b361cbb1351Google ScholarGoogle Scholar
  33. Nimrod Megiddo. 1984. Linear Programming in Linear Time When the Dimension Is Fixed. J. ACM, 31, 1 (1984), Jan., 114–127. issn:0004-5411 https://doi.org/10.1145/2422.322418 Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. Jean-Michel Muller. 2005. Elementary Functions: Algorithms and Implementation. Birkhauser. isbn:0817643729 https://doi.org/10.1007/978-1-4899-7983-4 Google ScholarGoogle ScholarCross RefCross Ref
  35. Santosh Nagarakatte, Mridul Aanjaneya, and Jay P. Lim. 2022. The RLIBM Project. https://www.cs.rutgers.edu/~santosh.nagarakatte/rlibm/Google ScholarGoogle Scholar
  36. NVIDIA. 2020. TensorFloat-32 in the A100 GPU Accelerates AI Training, HPC up to 20x. https://blogs.nvidia.com/blog/2020/05/14/tensorfloat-32-precision-format/Google ScholarGoogle Scholar
  37. Eugene Remes. 1934. Sur un procédé convergent d’approximations successives pour déterminer les polynômes d’approximation. Comptes rendus de l’Académie des Sciences, 198 (1934), 2063–2065.Google ScholarGoogle Scholar
  38. Jun Sawada. 2002. Formal verification of divide and square root algorithms using series calculation. In 3rd International Workshop on the ACL2 Theorem Prover and its Applications.Google ScholarGoogle Scholar
  39. Shane Story and Ping Tak Peter Tang. 1999. New algorithms for improved transcendental functions on IA-64. In Proceedings 14th IEEE Symposium on Computer Arithmetic. 4–11. https://doi.org/10.1109/ARITH.1999.762822 Google ScholarGoogle ScholarCross RefCross Ref
  40. Giuseppe Tagliavini, Stefan Mach, Davide Rossi, Andrea Marongiu, and Luca Benin. 2018. A transprecision floating-point platform for ultra-low power computing. In 2018 Design, Automation Test in Europe Conference Exhibition (DATE). 1051–1056. https://doi.org/10.23919/DATE.2018.8342167 Google ScholarGoogle ScholarCross RefCross Ref
  41. Ping-Tak Peter Tang. 1989. Table-Driven Implementation of the Exponential Function in IEEE Floating-Point Arithmetic. ACM Trans. Math. Software, 15, 2 (1989), June, 144–157. issn:0098-3500 https://doi.org/10.1145/63522.214389 Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. Ping-Tak Peter Tang. 1990. Table-Driven Implementation of the Logarithm Function in IEEE Floating-Point Arithmetic. ACM Trans. Math. Software, 16, 4 (1990), Dec., 378–400. https://doi.org/10.1145/98267.98294 Google ScholarGoogle ScholarDigital LibraryDigital Library
  43. P. T. P. Tang. 1991. Table-lookup algorithms for elementary functions and their error analysis. In [1991] Proceedings 10th IEEE Symposium on Computer Arithmetic. 232–236. https://doi.org/10.1109/ARITH.1991.145565 Google ScholarGoogle ScholarCross RefCross Ref
  44. Lloyd N. Trefethen. 2012. Approximation Theory and Approximation Practice (Other Titles in Applied Mathematics). Society for Industrial and Applied Mathematics, USA. isbn:1611972396Google ScholarGoogle Scholar
  45. Abraham Ziv. 1991. Fast Evaluation of Elementary Mathematical Functions with Correctly Rounded Last Bit. ACM Trans. Math. Software, 17, 3 (1991), Sept., 410–423. issn:0098-3500 https://doi.org/10.1145/114697.116813 Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Progressive polynomial approximations for fast correctly rounded math libraries

        Recommendations

        Comments

        Login options

        Check if you have access through your login credentials or your institution to get full access on this article.

        Sign in
        • Published in

          cover image ACM Conferences
          PLDI 2022: Proceedings of the 43rd ACM SIGPLAN International Conference on Programming Language Design and Implementation
          June 2022
          1038 pages
          ISBN:9781450392655
          DOI:10.1145/3519939
          • General Chair:
          • Ranjit Jhala,
          • Program Chair:
          • Işil Dillig

          Copyright © 2022 ACM

          Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

          Publisher

          Association for Computing Machinery

          New York, NY, United States

          Publication History

          • Published: 9 June 2022

          Permissions

          Request permissions about this article.

          Request Permissions

          Check for updates

          Qualifiers

          • research-article

          Acceptance Rates

          Overall Acceptance Rate406of2,067submissions,20%

          Upcoming Conference

          PLDI '24

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader